<?php
require_once("class/defs/constants.php");
require_once(FILE_CLASS_PROJECT);

/**
 * 
 * @version 0.1
 * @author Sander van Belleghem
 * 
 */

if (!isset($active)){
     header('Location: ../index.php?page=home');
}

if(isset($_POST['submit'])){
    try{
        $project = new Project($_POST);
        $project->save();
    }catch (Exception $e){
        echo("error");
        echo("<script type='text/javascript'>alert('" . $e->getMessage() . "');</script>");
    }
    
}

////$rechten_array = array(RIGHT_ADMIN_ADD, RIGHT_ADMIN_DEL_USER);
//
//$recht = new RechtBitfield();
//$recht->addRecht($rechten_array);
//                    $rechten_toevoegen = array(RIGHT_ADMIN_ADD, RIGHT_ADMIN_DEL_USER);
//                
//                    if($recht->heeftRechten($rechten_toevoegen)){
//                } else { 
//                    echo 'error';
//                }
 
?>

<div id="header">
    <div id="logo"></div>
    <div id="headertext">Project Toevoegen</div>
</div>
<div id="content2">
    <div id="contentbg">
        <div id="contentblock1">
            <div id="contentblock1text">
                <img src="images/add_project.png" height="50px" widht="50" border="0" /> <div style="margin: -35px 0px 0px 55px">Project toevoegen</div><br/><br/>
                <form action ='' method ='post'>
                    <table>
                        <tr>
                            <td><label for="naam">Projectnaam:</label></td>
                            <td><input name="naam_project" id="naam_project" type="text" /></td>
                        </tr>
                        <tr>
                            <td><label for="projectnr">Project nummer:</label></td>
                            <td><input name="projectnr" id="projectnr" type="text" /></td>
                        </tr>
                        <tr>
                            <td><label for="bedrijf">Klantnaam:</label></td>
                            <td><input name="klantnaam" id="klant" type="text" /></td>
                        </tr>
                        <tr>
                            <td><label for="bedrijf">Leidinggevende:</label></td>
                            <td><input name="leidinggevende" id="" type="text" /></td>
                        </tr>
                        </tr>
                        <tr>
                            <td><label for="bedrijf">Locatie:</label></td>
                            <td><input name="locatie" id="" type="text" /></td>
                        </tr>
                    </table>
                    <div id="buttons" style="margin: 5px 0px 0px 0px;">
                        <input type="submit" name="submit" id="knoppen" value="Toevoegen" alt="toevoegen" />
                    </div>
                </form>
            </div>
        </div>
    </div>        
</div>

